# -*- encoding: gb2312 -*- 
import os, sys, string
import poplib

host = "pop3.sohu.com " 
username = "xcnbanba@sohu.com" 
password = "NBANBA" 
pp = poplib.POP3(host)
pp.set_debuglevel(1)
pp.user(username)
pp.pass_(password)
ret = pp.stat()
print ret
for i in range( 1 , ret[0] + 1 ):
     mlist = pp.top(i, 0)
     print ' line: ' , len(mlist[ 1 ])
ret = pp.list()
print ret
down = pp.retr( 1 )
print ' lines: ' , len(down)
for line in down[ 1 ]:
     print line

pp.quit()